<template>
  <div class="registe">

    <!-- 标题 -->
    <div class="title">
      跨企业人才管理系统
    </div>
    <div class="each_info4" size="medium">
      <div style="text-align: center;font-size: 30px">忘记账号</div>
      <el-form class="apply-form first-form" :model="formData" :rules="rules" ref="form">
        <el-form-item label="真实姓名" prop="name" style="font-size: 15px">
          <el-input class="el-input" v-model="formData.name" placeholder="请输入姓名" clearable></el-input>
        </el-form-item>
        <el-form-item label="个人编号" prop="id">
          <el-input v-model="formData.id"  placeholder="请输入编号" clearable></el-input>
        </el-form-item>


        <el-form-item label="公司编号" prop="company_id">
          <el-input v-model="formData.company_id"  placeholder="请输入编号" clearable></el-input>
        </el-form-item>

        <el-form-item label="性别:" prop="gender">
          <el-radio-group v-model="formData.gender" fill="#ffff">
            <el-radio  label="男" border >男</el-radio>
            <el-radio  label="女" border>女</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="身份选择" prop="identity">
          <el-select v-model="formData.identity" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="邮箱" prop="email">
          <el-input v-model="formData.email"  placeholder="请输入邮箱" clearable></el-input>
        </el-form-item>
      </el-form>
      <el-row>

        <el-button round type="primary" style="left: 80px;width: 150px;position: relative" @click="submit">提交</el-button>
        <router-link to="/LoginChart"><el-button round type="warning" style="left: 120px;width: 150px;position: relative">
          返回</el-button></router-link>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  name: "forgetAccount",
  data() {
    return {
      formData: {
        id:'',
        name: '',
        company_id:'',
        email:'',
        gender:'男',
        identity: 'hr'
      },
      options: [{
        label:'hr',
        value: 'hr'
      }, {
        label:'部门主管',
        value: '部门主管'
      }],
      rules: {
        name: [
          {required: true, message: '请输入姓名', trigger: 'blur'},
          {min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur'},
          {
            required: true,
            pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
            message: '姓名不支持特殊字符',
            trigger: 'blur'
          }
        ],
        id:
          [
            {required: true, message: '请输入编号', trigger: 'blur'},
            {
              required: true,
              pattern: /^[a-zA-Z0-9]+$/,
              message: '请输入正确的编号',
              trigger: 'blur'
            }
          ],

        company_id:
          [
            {required: true, message: '请输入公司名称', trigger: 'blur'},
            {
              required: true,
              pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
              message: '请输入正确的公司名称',
              trigger: 'blur'
            }
          ],


        email:
          [
            {required: true, message: '请输入邮箱', trigger: 'blur'},
            {
              required: true,
              pattern: /^([a-zA-Z0-9]+[-_.]?)+@[a-zA-Z0-9]+\.[a-z]+$/,
              message: '请输入正确的邮箱',
              trigger: 'blur'
            },
          ]
      }
    }
  },
  methods: {
    submit(){

      this.axios(
        {
          method:"post",
          data:this.formData,
          url:'/staff/updateStaff'

        }).then((res)=>{
        if (res.data.msg=='error'){
          this.$message.error('查询失败')
        }else{
          this.$message({
            type:'success',
            message:res.data.msg.account_number
          })
          this.formData={brand_right:0}
        }
      }).catch(()=>{
        this.$message.error('查询失败,请联系管理员')
      })


    }
  }
}
</script>

<style>
.changethecolor1{
  color: red;
}
.changethecolor2{
  color: red;
}

.registe {
  width: 900px;
  height: 800px;
  margin: 60px auto 0;
  position: relative;
}
.each_info4 {
  justify-content: center;
  position: relative;
  top:50px;
  width: 500px;

  left: 160px;
  background: #FFFFFF;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 10px 40px 0 rgb(0 13 97);
}
.el-input{
  outline: none;
  border: none;
  background: none;
  color: #fff;
  font-size: 18px;
}

.el-form-item__label{
  font-size: 20px;
  color: black;
}
</style>
>
